//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.aidong.dao.wills;

import com.aidong.model.wills.MemberBlackList;
import org.springframework.stereotype.Repository;

@Repository
public class MemberBlackListDao extends BaseDao<MemberBlackList, Integer> {
    public MemberBlackListDao() {
    }

    public MemberBlackList getByIdTypeNumber(String idType, String idNumber) {
        String sqlw = "idType=:p1 and idNumber=:p2";
        return (MemberBlackList)this.getByWhere(sqlw, new Object[]{idType, idNumber});
    }

    public boolean exists(String idType, String idNumber) {
        String sql = "select count(*) from MemberBlackList where idType=:p1 and idNumber=:p2 and status>0";
        return ((Integer)this.getBySql(Integer.class, sql, new Object[]{idType, idNumber})).intValue() > 0;
    }

    public boolean chkExists(String idType, String idNumber) {
        String sql = "select count(*) from MemberBlackList where idType=:p1 and idNumber=:p2 and status=1";
        return ((Integer)this.getBySql(Integer.class, sql, new Object[]{idType, idNumber})).intValue() > 0;
    }

    public boolean updateStatus(int id, int status) {
        String hql = "update MemberBlackList set status=:p1 where autoId=:p2";
        return this.updateByHql(hql, new Object[]{Integer.valueOf(status), Integer.valueOf(id)}) > 0;
    }

    public boolean updateApprove(int id, int approve) {
        String hql = "update MemberBlackList set approve=:p1 where autoId=:p2";
        return this.updateByHql(hql, new Object[]{Integer.valueOf(approve), Integer.valueOf(id)}) > 0;
    }
}
